package dnem;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

import java.util.concurrent.TimeUnit;


public class Pagelogin {
    private WebDriver driver;


    public Pagelogin (WebDriver driver) throws InterruptedException {
        driver.findElement(By.xpath(".//*[@id='login_form']/div[1]/table/tbody/tr/td[3]/table/tbody/tr[2]/td/div/a")).click();
        TimeUnit.SECONDS.sleep(2);
        driver.findElement(By.xpath(".//*[@id='__pageBody']/div[2]/div[3]/div/div[2]/a")).click();
        TimeUnit.SECONDS.sleep(2);
        driver.findElement(By.id("signupEmail")).click();
        driver.findElement(By.id("signupEmail")).sendKeys("yarik.zavik61@yandex.ru");
        TimeUnit.SECONDS.sleep(2);
        driver.findElement(By.id("signup_password")).click();
        driver.findElement(By.id("signup_password")).sendKeys("yarik.zavik");
        TimeUnit.SECONDS.sleep(2);
        driver.findElement(By.xpath(".//*[@id='signup_table']/tbody/tr[5]/td[2]/div[1]/table/tbody/tr[2]/td/div")).click();
        TimeUnit.SECONDS.sleep(2);
        driver.findElement(By.xpath(".//*[@id='overlay']/table/tbody/tr[3]/td/div[1]/div/img")).click();
        String text=driver.findElement(By.id("tab-home")).getText();
        if (text.equals("Summary"))
        {
            System.out.println("Я залогинился");
        }
        else
        {
            System.out.println("Я не залогинился");
        }
    }
}